<template>
  <div>
    <el-card>
      <el-row :gutter="20">
        <!--   搜索下拉框   -->
        <el-col :span="6">
          <el-select v-model="value" clearable placeholder="请选择美食类别" style="margin: 20px">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="6">
          <el-input v-model="tableData.shop" placeholder="请输入店铺名称"></el-input>
        </el-col>
      </el-row>
      <el-button type="primary" @click="dialogFormVisible = true" style="margin: 20px">+新增</el-button>
      <!--    这里是表单    -->
      <el-dialog title="新增" :visible.sync="dialogFormVisible">
        <el-form :model="form">
          <el-form-item label="美食类别" :label-width="formLabelWidth">
            <el-input v-model="form.name" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="美食类别" :label-width="formLabelWidth">
            <el-select v-model="form.region" placeholder="请选择美食类别">
              <el-option label="火锅" value="duologue"></el-option>
              <el-option label="烤肉" value="karma"></el-option>
              <el-option label="自助餐" value="vulcanize"></el-option>
              <el-option label="猪肚鸡" value="zhuduji"></el-option>
              <el-option label="肉蟹煲" value="rouxiebao"></el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
        </div>
      </el-dialog>
      <!--    这里是表格      -->
      <el-table :data="tableData" stripe  style="width: 100%">
        <el-table-column prop="id" label="序号" width="180"></el-table-column>
        <el-table-column prop="name" label="美食类别" width="180"></el-table-column>
        <el-table-column prop="like" label="喜爱程度"></el-table-column>
        <el-table-column prop="shop" label="具体店铺名称"></el-table-column>
        <el-table-column prop="createTime" label="创建时间"></el-table-column>
        <el-table-column prop="operate" label="操作">
          <el-button type="primary" icon="el-icon-edit" circle></el-button>
          <el-button type="danger" icon="el-icon-delete" circle></el-button>
        </el-table-column>
      </el-table>
      <!--  分页    -->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="queryInfo.pagenum"
        :page-sizes="[2, 4, 6, 8]"
        :page-size="queryInfo.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="4"
      >
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryInfo: {
        query: '',
        pagenum: 1,
        pagesize: 2
      },
      tableData: [{
        id: 1,
        name: '火锅',
        like: '五颗星',
        shop: '刘一手火锅',
        createTime: '2023-03-01'
      }, {
        id: 2,
        name: '烤肉',
        like: '五颗星',
        shop: '韩宫宴',
        createTime: '2023-03-10'
      }, {
        id: 3,
        name: '肉蟹煲',
        like: '五颗星',
        shop: '胖哥俩',
        createTime: '2023-03-11'
      }, {
        id: 4,
        name: '猪肚鸡',
        like: '五颗星',
        shop: '十七湘',
        createTime: '2023-10-01'
      }],
      dialogTableVisible: false,
      dialogFormVisible: false,
      form: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      },
      formLabelWidth: '120px',
      options: [{
        value: '选项1',
        label: '火锅'
      }, {
        value: '选项2',
        label: '烤肉'
      }, {
        value: '选项3',
        label: '自助餐'
      }, {
        value: '选项4',
        label: '肉蟹煲'
      }, {
        value: '选项5',
        label: '猪肚鸡'
      }],
      values: '',
      option: [],
      value: [],
      list: [],
      loading: false,
      states: ['刘一手火锅店', '十七湘', '胖哥俩', '小猪查理', '韩宫宴'],
      currentPage: 1
    }
  },
  methods: {
    handleSizeChange(newSize) {
      this.queryInfo.pagesize = newSize
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    }
  }
}
</script>

<style scoped>
.block {
  margin: 10px;

}
</style>
